﻿namespace NoIdeaIoc;
/// <summary>
/// 获取Ioc值时返回的结果
/// </summary>
class IocResponse
{
    readonly string cacheKey;
    readonly object instance;
    readonly ServiceLifetime serviceLifetime;
    public IocResponse(string cacheKey, object instance, ServiceLifetime serviceLifetime)
    {
        this.cacheKey = cacheKey;
        this.instance = instance;
        this.serviceLifetime = serviceLifetime;
    }
    /// <summary>
    /// 缓存键名
    /// </summary>
    public string CacheKey => cacheKey;
    /// <summary>
    /// 实例
    /// </summary>
    public object Instance => instance;
    /// <summary>
    /// 生命周期类型
    /// </summary>
    public ServiceLifetime ServiceLifetime => serviceLifetime;
    internal static MethodInfo GetInstanceMethod() => typeof(IocResponse).GetMethod("get_Instance", BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty, null, Type.EmptyTypes, null);
}